//
//  PTCommandESC.h
//  PrinterCommand
//
//  Created by midmirror on 16/3/10.
//  Copyright © 2016年 midmirror. All rights reserved.
//

#import <Foundation/Foundation.h>

typedef NS_ENUM(NSInteger, ESCText) {
    
    ESCTextNormal = 0,
    ESCTextMini = 1,
    ESCTextBold = 8,
    ESCTextDoubleHeight = 16,
    ESCTextDoubleWidth = 32,
    ESCTextUnderline = 128,
};

typedef NS_ENUM(NSInteger, ESCBarcode) {
    
//    ESCBarcodeA_UPCA    = 0,
//    ESCBarcodeA_UPCE    = 1,
//    ESCBarcodeA_EAN13   = 2,
//    ESCBarcodeA_EAN8    = 3,
//    ESCBarcodeA_CODE39  = 4,
//    ESCBarcodeA_ITF     = 5,
//    ESCBarcodeA_CODEBAR = 6,
    
    ESCBarcodeB_UPCA    = 65,
    ESCBarcodeB_UPCE    = 66,
    ESCBarcodeB_EAN13   = 67,
    ESCBarcodeB_EAN8    = 68,
    ESCBarcodeB_CODE39  = 69,
    ESCBarcodeB_ITF     = 70,
    ESCBarcodeB_CODEBAR = 71,
    ESCBarcodeB_CODE93  = 72,
    ESCBarcodeB_CODE128 = 73,
//    ESCBarcodeB_EAN128  = 74,
//    ESCBarcodeB_RSS14   = 75,
//    ESCBarcodeB_RSS14T  = 76,
//    ESCBarcodeB_RSSL    = 77,
//    ESCBarcodeB_RSSE    = 78,
};


/**
 *  ESC-POS 指令集:大约200个生成指令的函数。
 *  ESC-POS command set: about 200 functions which generated into command
 */
@interface PTCommandESC : NSObject

/**
 *   字符串编码格式，默认kCFStringEncodingGB_18030_2000
 *   Encoding format of character string, default is kCFStringEncodingGB_18030_2000
 */
@property (nonatomic, assign) NSStringEncoding encoding;

- (void)initCommandQueue;

- (void)appendCommandData:(NSData *)cmdData;

- (NSData *)getCommandData;

- (void)appendText:(NSString *)text;

/**
 *  page 165. 设置对齐方式
 *  Set justification
 *  n = 0 [default]
 *  0,48 left justification
 *  1,49 centered
 *  2,50 right justification
 *
 *  @param justification (0~2),(48~50)
 */
- (void)setJustification:(NSInteger)justification;

/**
 *  page 169. 设置左边空白宽度
 *  Set left margin width
 *  @param left 左对齐 (0~65535)
 */
- (void)setLeftMargin:(NSInteger)left;

/**
 
 Document 14.2
 *  @param justification    page 165. 对齐方式       取值0,1,2 : 左、中、右
 *  @param leftMargin       page 169. 左间距
 *  @param model            page 552. 二维码样式     取值49,50 : 两种样式
 *  @param size             page 553. 大小          取值1~16
 *  @param eccLevel         page 555. 纠错等级       取值48~51: Level L,M,Q,H
 *  @param data             page 557. 二维码数据
 */
- (void)appendQRCodeData:(NSString *)data
           justification:(NSInteger)justification
              leftMargin:(NSInteger)leftMargin
                eccLevel:(NSInteger)eccLevel
                   model:(NSInteger)model
                    size:(NSInteger)size;

- (void)appendQRCodeData1:(NSString *)data1
                    Data2:(NSString *)data2
            justification:(NSInteger)justification
               leftMargin:(NSInteger)leftMargin
              leftMargin2:(NSInteger)leftMargin2
                 eccLevel:(NSInteger)eccLevel
                    model:(NSInteger)model
                     size:(NSInteger)size;
@end
